"use strict";
{
    //声明函数
    function add(a, b) {
        return a + b;
    }
    //匿名函数
    let sub = function (a, b) {
        return a - b;
    };
    //箭头函数
    let divide = (a, b) => {
        return a / b;
    };
    //返回值类型可以省略
    let times = (a, b) => {
        return a * b;
    };
    //函数类型的变量声明
    // let pow: (a: number, b: number) => number; 
    // pow = (a, b) => {
    //   return a**b;
    // }
    let pow = (a, b) => {
        return a ** b;
    };
    //可选参数的设置  'abc'.slice(1)  'abc'.slice(1, 6)
    function slice(str, start, end) {
    }
    slice('xxx', 2, 5);
    slice('xxx', 1);
    //剩余参数
    function sum(...args) {
        console.log(args);
    }
    sum(1, 2, 3);
    sum(1, 2, 3, 4, 5, 6, 6);
    sum(1, 2, 3, 4, 51, 12, 12, 3, 44, 4, 19);
    //函数参数的默认值
    function buildPhone(code, area = "+86") {
        return area + code;
    }
    buildPhone('13898743569', '+86');
    buildPhone('13898743569', '+123');
    buildPhone('13898743569');
}
